﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using JXT.PrimaryKey.Batman.Core.Infrastructure;

namespace JXT.PrimaryKey.Batman.Core.Configuration
{
    /// <summary>
    /// 默认配置管理器
    /// </summary>
    public static class SupernovaConfigurationManager
    {
        private static readonly string _configurationSectionName = "systemConfiguration";

        private static ServiceConfigurationSection _serviceConfigurationSection;
        private static WebConfigurationSection _webConfigurationSection;

        /// <summary>
        /// 获取系统服务配置Section
        /// </summary>
        /// <returns></returns>
        public static ServiceConfigurationSection GetServiceConfigurationSection()
        {
            if(_serviceConfigurationSection==null)
                _serviceConfigurationSection = ConfigurationManager.GetSection(_configurationSectionName) as ServiceConfigurationSection;
            return _serviceConfigurationSection;
        }

        /// <summary>
        /// 获取Web配置Section
        /// </summary>
        /// <returns></returns>
        public static WebConfigurationSection GetWebConfigurationSection()
        {
            if(_webConfigurationSection==null)
                _webConfigurationSection = ConfigurationManager.GetSection(_configurationSectionName) as WebConfigurationSection;
            return _webConfigurationSection;
        }
    }
}
